public class Main {
    public static void main(String[] args) {
        // 创建渲染引擎
        Renderer vectorRenderer = new VectorRenderer();
        Renderer rasterRenderer = new RasterRenderer();

        // 桥接形状与渲染引擎
        Shape circle = new Circle(vectorRenderer, 5.0f);
        Shape square = new Square(rasterRenderer, 10.0f);

        circle.draw();  // 输出：矢量渲染圆形，半径：5.0
        square.draw();  // 输出：光栅渲染方形，边长：10.0

        // 动态切换渲染引擎
        circle = new Circle(rasterRenderer, 5.0f);
        circle.draw();  // 输出：光栅渲染圆形，半径：5.0
    }
}
